<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // var n = new Date()
        // console.log(n);
        
        // var n1 = new Date('2001-1-2')
        // var n2 = new Date('2001/1/2')
        // console.log(n1,n2);
        

        //获取年月日时分秒
        var t3 = new Date()
        //获取年
        var nn = t3.getFullYear()
        console.log(nn)
        //获取月
        var yy = t3.getMonth() + 1
        console.log(yy)
        //获取时分秒
        console.log(t3.getHours()) //时
        console.log(t3.getMinutes())//分
        console.log(t3.getSeconds())//秒
        //获取周几
        var day = t3.getDay()
        console.log(day)
    </script>
</body>
</html>